Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools: ros2: Improve ability to launch plane in headless mode #27131

Merged

Conversation

Ryanf55
Copy link
Collaborator

@Ryanf55 Ryanf55 commented May 22, 2024

Purpose

  • Install models for other users such as the plane.parm that SITL launches with for plane
  • Fix bool parsing in some launch args such as mavproxy and console

Testing

Create a launch file with the contents;

<?xml version="1.0"?>
<launch>
  <include file="$(find-pkg-share ardupilot_sitl)/launch/sitl_dds_udp.launch.py">
    <arg name="defaults" value="$(find-pkg-share ardupilot_sitl)/config/models/plane.parm"/>
    <arg name="model" value="plane"/>
    <arg name="command" value="arduplane"/>
  </include>
</launch>
ros2 launch your_package your_launch_file.launch.xml \
   refs:=$(pwd)/src/ardupilot/libraries/AP_DDS/dds_xrce_profile.xml \
   map:=True \
   console:=True

Then, change map and console to false and observe them not appear.
The plane should boot up just like sim_vehicle, and be able to use mavproxy.
Mavproxy should show a plane icon.

Issue

Solves #27130

I found this running colcon test and saw a ton of windows popping up.

image

Follow up

I'd like CMake to install the refs file and default that location so you don't need to specify the refs path when you launch in a directory other than ardupilot.

* Install models for other users
* Fix bool parsing in some launch args
@Ryanf55 Ryanf55 requested a review from srmainwaring May 22, 2024 08:18
@Ryanf55 Ryanf55 self-assigned this May 22, 2024
Copy link
Contributor

@srmainwaring srmainwaring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Only question is whether we need the additional JSON files from the directory containing the plane.parm file.

Tools/ros2/ardupilot_sitl/CMakeLists.txt Show resolved Hide resolved
@srmainwaring
Copy link
Contributor

I'd like CMake to install the refs file and default that location so you don't need to specify the refs path when you launch in a directory other than ardupilot.

The DDS refs file is already installed to ./install/ardupilot_sitl/share/ardupilot_sitl/config/dds_xrce_profile.xml. Did you have something else in mind?

@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented May 23, 2024

Looks good. Only question is whether we need the additional JSON files from the directory containing the plane.parm file.

I wasn't sure. If you think I should leave them out, I'll add a matcher to only copy .parm and .param.

@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented May 23, 2024

I'd like CMake to install the refs file and default that location so you don't need to specify the refs path when you launch in a directory other than ardupilot.

The DDS refs file is already installed to ./install/ardupilot_sitl/share/ardupilot_sitl/config/dds_xrce_profile.xml. Did you have something else in mind?

No,let me try using that in the launch file.

Without specifying the refs, it fails to boot.

[micro_ros_agent-4] [1716444996.738845] info     | Root.cpp           | create_client            | create                 | client_key: 0xAAAABBBB, session_id: 0x81
[micro_ros_agent-4] [1716444996.738898] info     | SessionManager.hpp | establish_session        | session established    | client_key: 0xAAAABBBB, address: 127.0.0.1:57036
[micro_ros_agent-4] 2024-05-23 06:16:36.739 [XMLPARSER Error] Profile 'participant_profile' not found -> Function fillParticipantAttributes

Once I add this, it works;

  <include file="$(find-pkg-share ardupilot_sitl)/launch/sitl_dds_udp.launch.py">
    <arg name="defaults" value="$(find-pkg-share ardupilot_sitl)/config/models/plane.parm"/>
    <arg name="model" value="plane"/>
    <arg name="command" value="arduplane"/>
    <arg name="refs" value="$(find-pkg-share ardupilot_sitl)/config/dds_xrce_profile.xml"/>
  </include>

Nothing needs to change in this PR, so I think the code is good to go as-is.

@Ryanf55 Ryanf55 added the ROS label May 23, 2024
@Ryanf55 Ryanf55 added this to the DDS 4.6 milestone May 23, 2024
@srmainwaring
Copy link
Contributor

I wasn't sure. If you think I should leave them out, I'll add a matcher to only copy .parm and .param

It's good as is.

Nothing needs to change in this PR, so I think the code is good to go as-is.

LGTM. The launch examples at the end of the /Tools/ros2/README use the installed ref files.

@peterbarker peterbarker merged commit 8a58aff into ArduPilot:master May 25, 2024
91 checks passed
@Ryanf55 Ryanf55 deleted the dds-fix-launch-for-plane-headless branch August 21, 2024 23:25
@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Aug 21, 2024

@srmainwaring Thoughts on backporting this to 4.5?

@Ryanf55 Ryanf55 mentioned this pull request Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants